#include "stdio.h"
#include "stdlib.h"
#include "time.h"

int main()
{
    int x;
    int x_guess = -1;

    srand(time(NULL)); // seed the randomization according current time. What if removing this?

    x = rand() % 10;
    while (1)
    {
//        x_guess = scanf("%d", &x_guess); // guess and try

        printf("Type in an integer in [0,9]:\n");

        scanf("%d", &x_guess);
        
        if (x == x_guess)
        {
            printf("Congratulations!\n");
            break;
        }
        else if(x > x_guess)
        {
            printf("Try a bigger one\n");
        }
        else
        {
            printf("Try a smaller one\n");
        }
    } 

    return 0;
}

 

       
